package com.sumainfor.pc.epc.controller;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.epc.feign.Housingauditfeign;
import com.sumainfor.pc.epc.service.impl.Tcepc_housing_planServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Author Xfma
 * @Date 2018年11月7日
 * @Describe 工程部查询房源配置
 */
@RestController
@RequestMapping("/Hauditcoller")
public class HousingauditController {
    @Autowired
    private Housingauditfeign feign;

    @Autowired
    Tcepc_housing_planServiceImpl biz;


    @ResponseBody
    @RequestMapping("getCommNi")
    public JsonResult getCommNi() {
        System.err.println("123");
        return feign.getCommNi();
    }

    @ResponseBody
    @RequestMapping("/getHousing")
    public JsonResult  getHousing(@RequestParam Map<String,Object> params, Pager pager) throws  Exception{
        JsonResult result = new JsonResult();
        System.out.println("paramns------->"+params);
        return feign.getHousing(params,pager);
    }

    @ResponseBody
    @RequestMapping("/getHousingByFinState")
    public JsonResult  getHousingByFinState() throws  Exception{
        JsonResult result = new JsonResult();
        return feign.getHousingByFinState();
    }

    @ResponseBody
    @RequestMapping("/updateHousingState")
    public JsonResult updateHousingState(@RequestParam Map<String,Object> params) throws  Exception{
        System.out.println("paramns------->"+params);
        return feign.updateHousingState(params);
    }



    /**
     * 装修计划结算单查看详情
     * @param params
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping("getHousingCon")
    public JsonResult getHousingCon(@RequestParam Map<String, Object> params) throws Exception {

        return biz.getHousingCon(params);
    }


    /**
     * 按照房源编号查询房源详细信息
     * @param params
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping("getListingDetails")
    public JsonResult getListingDetails(@RequestParam Map<String, Object> params) throws Exception {

        return biz.getListingDetails(params);
    }

    /**
     *新增房源配置
     * @param params
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping("saveConInfo")
    public JsonResult saveConInfo(@RequestBody Map<String,Object> params) throws  Exception{

        return biz.saveConInfo(params);
    }

    /**
     * 按照房源配置id加房源配置子id 删除一个房源配置
     * @param params
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping("deleteConInfo")
    public JsonResult deleteConInfo(@RequestParam Map<String,Object> params) throws  Exception{
        System.out.println(params);
        return biz.deleteConInfo(params);
    }

    /**
     * 按照房源配置id加房源配置子id 修改一个房源配置
     * @param params
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping("updateConInfo")
    public JsonResult updateConInfo(@RequestBody Map<String,Object> params) throws  Exception{

        System.out.println(params);
        return biz.updateConInfo(params);
    }


    /**
     * 按照房源配置id加房源配置子id 修改一个房源配置
     * @param params
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping("updateHousingByFinState")
    public JsonResult updateHousingByFinState(@RequestParam Map<String,Object> params) throws  Exception{
        return feign.updateHousingByFinState(params);
    }



    /**
     * 查询是否可以预销
     * @param params
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping("gettcmkt_housingByHouId")
    public JsonResult gettcmkt_housingByHouId(@RequestParam Map<String,Object> params) throws  Exception{


        return feign.gettcmkt_housingByHouId(params);
    }


}
